<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="新增ERP付款信息" bodyClass="white-bg" libs=["prism","bootstrapSelect","ueditor"]/>
<div class="wrapper wrapper-content ibox-content">
    <@form.form id="form-pay-add"  class="form-horizontal">
    <input name="id" value="${bpmErpPersonPay.id}" type="hidden">
    <div class="form-group"><label class="col-sm-3 control-label"><@ctx.i18n text = "流水号"/>：
    </label>
        <div class="col-sm-8"><input name="serialNumber" value="${bpmErpPersonPay.serialNumber}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group"><label class="col-sm-3 control-label"><@ctx.i18n text = "申请人"/>：
    </label>
        <div class="col-sm-8"><input name="applyUsername" value="${bpmErpPersonPay.applyUsername?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group"><label class="col-sm-3 control-label"><@ctx.i18n text = "受益人"/>：
    </label>
        <div class="col-sm-8"><input name="beneficiaryUsername" value="${bpmErpPersonPay.beneficiaryUsername?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group"><label class="col-sm-3 control-label"><@ctx.i18n text = "选择账户"/>：
    </label>
        <div class="col-sm-8"><input name="selectAccount" value="${bpmErpPersonPay.selectAccount?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group"><label class="col-sm-3 control-label"><@ctx.i18n text = "账户余额"/>：
    </label>
        <div class="col-sm-8"><input name="accountBalance" value="${bpmErpPersonPay.accountBalance?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group"><label class="col-sm-3 control-label"><@ctx.i18n text = "金额"/>：
    </label>
        <div class="col-sm-8"><input name="payMoney" value="${bpmErpPersonPay.payMoney?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><@ctx.i18n text = "备注"/>：</label>
        <div class="col-sm-8">
            <textarea name="payMemo" class="form-control" readonly="true">${bpmErpPersonPay.payMemo?default('')}</textarea>
        </div>
    </div>
    <#if bpmErpPersonPay.processStatus==1 >
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "确认打款"/>：</label>
        <div class="col-sm-8">
            <@form.radio name="payConfirmpay" dictType="sys_crm_isOrNo" value="${bpmErpPersonPay.payConfirmpay?default('1')}" required="true" />
        </div>
    </div>
    <div class="form-group confirmClass">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "打款日期"/>：</label>
        <div class="col-sm-8">
            <div class="input-group date">
                <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                <input class="form-control time-input" name="payPaymentdate"  data-type="date" value="${(bpmErpPersonPay.payPaymentdate?string('yyyy-MM-dd'))!}" data-format="yyyy-MM-dd" type="text" required/>
            </div>
        </div>
    </div>
    <div class="form-group confirmClass">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "偏好付款方式"/>：</label>
        <div class="col-sm-8">
            <@form.select name="payPreferencePaymethod" dictType="sys_erp_first_paymethod" value="${bpmErpPersonPay.payPreferencePaymethod?default('')}" required="true" />
        </div>
    </div>
    <div class="form-group confirmClass">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "付款方式备注"/>：</label>
        <div class="col-sm-8">
            <textarea name="payMethodMemo" class="form-control" required>${bpmErpPersonPay.payMethodMemo?default('')}</textarea>
        </div>
    </div>

    <div class="form-group confirmClass">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "附件"/>：
    </label>
        <div class="col-sm-8">

            <div class="layui-upload">
                <button type="button" class="btn btn-success btn-sm" id="proofList"><i class="fa fa-upload"></i> 上传附件</button>
                <div class="layui-upload-list layui-upList-minHeight uploadpadding">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th>文件名</th>
                            <th>大小</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="demoproofList">
                        </tbody>
                    </table>
                </div>
                <div class="layui-form-item layui-btn-Center">
                    <div class="layui-input-block text-right">
                        <button type="button" class="layui-btn layui-btn-xs" id="proofListAction">开始上传</button>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <div class="form-group confirmClass">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "证明"/>：
    </label>
        <div class="col-sm-8"><input name="payProof" value="${bpmErpPersonPay.payProof?default('')}" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group checkClass">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "接收人名称"/>：
    </label>
        <div class="col-sm-8"><input name="payRecipientName" value="${bpmErpPersonPay.payRecipientName?default('')}" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group checkClass">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "接收人地址"/>：
    </label>
        <div class="col-sm-8"><input name="payRecipientAddress" value="${bpmErpPersonPay.payRecipientAddress?default('')}" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group checkClass">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "接收人手机"/>：
    </label>
        <div class="col-sm-8"><input name="payRecipientPhone" value="${bpmErpPersonPay.payRecipientPhone?default('')}" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group wireClass">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "金额"/>：
    </label>
        <div class="col-sm-8"><input name="payAccountNumber" value="${bpmErpPersonPay.payAccountNumber?default('')}" class="form-control" type="number" required>
        </div>
    </div>
    <div class="form-group wireClass">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "汇款路径号码"/>：
    </label>
        <div class="col-sm-8"><input name="payRoutingNumber" value="${bpmErpPersonPay.payRoutingNumber?default('')}" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group wireClass">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "开户行"/>：
    </label>
        <div class="col-sm-8"><input name="payBankAddress" value="${bpmErpPersonPay.payBankAddress?default('')}" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group rmbClass">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "人民币汇款"/>：</label>
        <div class="col-sm-8">
            <@form.radio name="payRmbRemittanceMethod" dictType="sys_crm_isOrNo" value="${bpmErpPersonPay.payRmbRemittanceMethod?default('1')}" required="true" />
        </div>
    </div>

    <div class="form-group rmbClassMoney" >       <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "银行名称"/>：
    </label>
        <div class="col-sm-8"><input name="payBankName" value="${bpmErpPersonPay.payBankName?default('')}" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group rmbClassMoney">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "银行账号"/>：
    </label>
        <div class="col-sm-8"><input name="payBankAccount" value="${bpmErpPersonPay.payBankAccount?default('')}" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group rmbClassMoney">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "账户备注"/>：
    </label>
        <div class="col-sm-8"><input name="payAccountName" value="${bpmErpPersonPay.payAccountName?default('')}" class="form-control" type="text" required>
        </div>
    </div>

</#if>
<#if bpmErpPersonPay.processStatus!=1 >
    <div class="form-group">
        <label class="col-sm-3 control-label"><@ctx.i18n text = "确认打款"/>：</label>
        <div class="col-sm-8">
            <@form.radio name="payConfirmpay" dictType="sys_crm_isOrNo" value="${bpmErpPersonPay.payConfirmpay?default('')}" readOnly="true" />
        </div>
    </div>
    <div class="form-group confirmClass">
        <label class="col-sm-3 control-label"><@ctx.i18n text = "打款日期"/>：</label>
        <div class="col-sm-8">
            <div class="input-group date">
                <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                <input class="form-control" name="payPaymentdate"  data-type="date" value="${(bpmErpPersonPay.payPaymentdate?string('yyyy-MM-dd'))!}" data-format="yyyy-MM-dd" type="text" readonly="true"/>
            </div>
        </div>
    </div>
    <div class="form-group confirmClass">
        <label class="col-sm-3 control-label"><@ctx.i18n text = "偏好付款方式"/>：</label>
        <div class="col-sm-8">
            <@form.select name="payPreferencePaymethod" dictType="sys_erp_first_paymethod" value="${bpmErpPersonPay.payPreferencePaymethod?default('')}" readOnly="true" />
        </div>
    </div>
    <div class="form-group confirmClass">
        <label class="col-sm-3 control-label"><@ctx.i18n text = "付款方式备注"/>：</label>
        <div class="col-sm-8">
            <textarea name="payMethodMemo" class="form-control" readonly="true">${bpmErpPersonPay.payMethodMemo?default('')}</textarea>
        </div>
    </div>

    <div class="form-group confirmClass">        <label class="col-sm-3 control-label"><@ctx.i18n text = "附件"/>：
    </label>
        <div class="col-sm-8">

            <div class="layui-upload">
                <div class="layui-upload-list layui-upList-minHeight uploadpadding">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th>文件名</th>
                            <th>大小</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="demojiazhaoList">
                        <tr id="upjiazhaoload"></tr>
                        <#list proof as item>
                        <tr id="upload${item_index}">
                            <td> ${item.fileName?default("")}</td>
                            <td> ${item.fileSize?default("")}</td>
                            <td>已上传</td>
                            <td>
                                <a class="btn btn-danger btn-sm" href="#" download="${item.url}"><i class="fa fa-download"></i></a>
                            </td>
                        </tr>
                        </#list>
                        </tbody>
                    </table>
                </div>
            </div>

        </div>
    </div>
    <div class="form-group confirmClass">        <label class="col-sm-3 control-label"><@ctx.i18n text = "证明"/>：
    </label>
        <div class="col-sm-8"><input name="payProof" value="${bpmErpPersonPay.payProof?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group checkClass">        <label class="col-sm-3 control-label"><@ctx.i18n text = "接收人名称"/>：
    </label>
        <div class="col-sm-8"><input name="payRecipientName" value="${bpmErpPersonPay.payRecipientName?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group checkClass">        <label class="col-sm-3 control-label"><@ctx.i18n text = "接收人地址"/>：
    </label>
        <div class="col-sm-8"><input name="payRecipientAddress" value="${bpmErpPersonPay.payRecipientAddress?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group checkClass">        <label class="col-sm-3 control-label"><@ctx.i18n text = "接收人手机"/>：
    </label>
        <div class="col-sm-8"><input name="payRecipientPhone" value="${bpmErpPersonPay.payRecipientPhone?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group wireClass">        <label class="col-sm-3 control-label"><@ctx.i18n text = "账户号码"/>：
    </label>
        <div class="col-sm-8"><input name="payAccountNumber" value="${bpmErpPersonPay.payAccountNumber?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group wireClass">        <label class="col-sm-3 control-label"><@ctx.i18n text = "邮政编号"/>：
    </label>
        <div class="col-sm-8"><input name="payRoutingNumber" value="${bpmErpPersonPay.payRoutingNumber?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group wireClass">        <label class="col-sm-3 control-label"><@ctx.i18n text = "开户行"/>：
    </label>
        <div class="col-sm-8"><input name="payBankAddress" value="${bpmErpPersonPay.payBankAddress?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group rmbClass">
        <label class="col-sm-3 control-label"><@ctx.i18n text = "人民币汇款"/>：</label>
        <div class="col-sm-8">
            <@form.radio name="payRmbRemittanceMethod" dictType="sys_crm_isOrNo" value="${bpmErpPersonPay.payRmbRemittanceMethod?default('')}" readOnly="true" />
        </div>
    </div>
    <div class="form-group rmbClassMoney">        <label class="col-sm-3 control-label"><@ctx.i18n text = "银行名称"/>：
    </label>
        <div class="col-sm-8"><input name="payBankName" value="${bpmErpPersonPay.payBankName?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group rmbClassMoney">        <label class="col-sm-3 control-label"><@ctx.i18n text = "银行账号"/>：
    </label>
        <div class="col-sm-8"><input name="payBankAccount" value="${bpmErpPersonPay.payBankAccount?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group rmbClassMoney">        <label class="col-sm-3 control-label"><@ctx.i18n text = "账户名称"/>：
    </label>
        <div class="col-sm-8"><input name="payAccountName" value="${bpmErpPersonPay.payAccountName?default('')}" class="form-control" type="text" readonly="true">
        </div>
    </div>
<div class="form-group">
    <label class="col-sm-3 control-label"><@ctx.i18n text = "付款结果"/>：</label>
    <div class="col-sm-8">
        <@form.radio name="cashierPaymentResult" dictType="sys_crm_isOrNo" value="${bpmErpPersonPay.cashierPaymentResult?default('')}" readOnly="true" />
    </div>
</div>
<div class="form-group">
    <label class="col-sm-3 control-label"><@ctx.i18n text = "出纳日期"/>：</label>
    <div class="col-sm-8">
        <div class="input-group date">
            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
            <input class="form-control" name="cashierDate"  data-type="date" value="${(bpmErpPersonPay.cashierDate?string('yyyy-MM-dd'))!}" data-format="yyyy-MM-dd" type="text" readonly="true" />
        </div>
    </div>
</div>
<div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "接收人编号"/>：
</label>
    <div class="col-sm-8"><input name="cashierReceiptNumber" value="${bpmErpPersonPay.cashierReceiptNumber?default('')}" class="form-control" type="text" readonly="true">
    </div>
</div>
<div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "出纳证明"/>：
</label>
    <div class="col-sm-8"><input name="cashierProof" value="${bpmErpPersonPay.cashierProof?default('')}" class="form-control" type="text" readonly="true">
    </div>
</div>
<div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "出纳备注"/>：
</label>
    <div class="col-sm-8"><textarea name="cashierMemo" class="form-control"
                                    readonly="true">${bpmErpPersonPay.cashierMemo?default('')}</textarea>
    </div>
</div>
<div class="form-group">
    <label class="col-sm-3 control-label"><@ctx.i18n text = "出纳提交时间"/>：</label>
    <div class="col-sm-8">
        <div class="input-group date">
            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
            <input class="form-control" name="cashierSubmitTime"  data-type="date" value="${(bpmErpPersonPay.cashierSubmitTime?string('yyyy-MM-dd HH:mm:ss'))!}" data-format="yyyy-MM-dd" type="text" readonly="true" />
        </div>
    </div>
</div>
</#if>
<input id="processStatus" type="hidden" value="${bpmErpPersonPay.processStatus?default('')}">
</@form.form>
</div>
<@footer>
<script type="text/javascript">
    $(function () {
        var processStatusValue = $("#processStatus").val();
        if (processStatusValue == "1") {
            setHidden();
        } else if (processStatusValue == "2") {
            setHidden();
        } else if (processStatusValue == "3") {
            setHidden();
        }
    })
    function setHidden(){
        var payConfirmpayValue = $("[name='payConfirmpay']")[0].checked;
        if(payConfirmpayValue){
            $(".confirmClass").show();
            setSelectHidden();
        }
        else{
            $(".confirmClass").hide();
            $(".checkClass").hide();
            $(".wireClass").hide();
            $(".rmbClass").hide();
            $(".rmbClassMoney").hide();
        }

    }

    function setSelectHidden(){
        var payPreferencePaymethodValue=$("[name='payPreferencePaymethod']").val();

        if(payPreferencePaymethodValue=="1"){
            $(".checkClass").show();
            $(".wireClass").show();
            $(".rmbClass").hide();
            $(".rmbClassMoney").hide();
        }
        else if(payPreferencePaymethodValue=="2"){
            $(".checkClass").hide();
            $(".wireClass").show();
            $(".rmbClass").hide();
            $(".rmbClassMoney").hide();
        }
        else if(payPreferencePaymethodValue=="3"){
            $(".checkClass").hide();
            $(".wireClass").hide();
            $(".rmbClass").show();
            if($("[name='payRmbRemittanceMethod']")[0].checked){
                $(".rmbClassMoney").show();
            }
            else{
                $(".rmbClassMoney").hide();
            }
        }
        else{
            $(".checkClass").hide();
            $(".wireClass").hide();
            $(".rmbClass").hide();
            $(".rmbClassMoney").hide();
        }
    }
    var prefix = baseURL + "erp/pay"
    $("#form-pay-add").validate({
        focusCleanup: true
    });

    function submitHandler() {

        if (opt.validate.form()) {
            var fileLength=$("#demoproofList").children().length;
            if(fileLength<=0){
                opt.warning("请上传附件");
                return;
            }
            opt.operate.save(prefix + "/view2", $('#form-pay-add').serialize());
        }
    }
    /**
     * redio 单选回调
     * @param id
     * @param data
     * @param event
     */
    function  redioCallback(id,data,event){
        if(id == "payConfirmpay"){
            if ($(data).is(':checked')){
                var menuType = $(event.target).val();
                if(menuType=="1"){
                    $(".confirmClass").show();
                    setSelectHidden();
                }
                else{
                    $(".confirmClass").hide();
                    $(".checkClass").hide();
                    $(".wireClass").hide();
                    $(".rmbClass").hide();
                    $(".rmbClassMoney").hide();
                }
            }
        }
        else if(id=="payRmbRemittanceMethod"){
            if($(".rmbClass").is(":hidden")){
                $(".rmbClassMoney").hide();
            }
            else{
                if ($(data).is(':checked')){
                    var menuType = $(event.target).val();
                    if(menuType=="1"){
                        $(".rmbClassMoney").show();
                    }
                    else{
                        $(".rmbClassMoney").hide();
                    }
                }
            }
        }
    }
    /**
     * 下拉选择框 回调函数案例
     * @param id
     * @param event
     * @param data
     */
    function selectCallback(id, event, data) {
        if (id == "payPreferencePaymethod") {
            var payPreferencePaymethodValue=data[0].id;
            if(payPreferencePaymethodValue=="1"){
                $(".checkClass").show();
                $(".wireClass").show();
                $(".rmbClass").hide();
                $(".rmbClassMoney").hide();
            }
            else if(payPreferencePaymethodValue=="2"){
                $(".checkClass").hide();
                $(".wireClass").show();
                $(".rmbClass").hide();
                $(".rmbClassMoney").hide();
            }
            else if(payPreferencePaymethodValue=="3"){
                $(".checkClass").hide();
                $(".wireClass").hide();
                $(".rmbClass").show();
                if($("[name='payRmbRemittanceMethod']")[0].checked){
                    $(".rmbClassMoney").show();
                }
                else{
                    $(".rmbClassMoney").hide();
                }
            }
            else{
                $(".checkClass").hide();
                $(".wireClass").hide();
                $(".rmbClass").hide();
                $(".rmbClassMoney").hide();
            }
        }
    }
    //在插件中使用对象
    $.fn.upfile = function(type) {
        var upfile = new Upfile(this,'',$("input[name='serialNumber']").val(),type);
        layui.use('upload', function() {
            var upload = layui.upload;
            var UplodeIn = upload.render(upfile.options);
            upfile.SetInst(UplodeIn)

        });

    };
    /**
     * 凭证
     */
    $('#proofList').upfile(5);
</script>
</@footer>
</@pageTheme>